package niseeImageGenerator;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Random;
//import testgenerator.*;
/**
 *
 * @author stussy
 */
public class niShape implements Serializable{

    protected int x, y, size;
    protected Color colour;

    public niShape(int tx, int ty, int tsize) {
        x = tx;
        y = ty;
        size = tsize;
        colour = Color.black;
    }

    public int getX(){
        return x;
    }

    public int getY() {
        return y;
    }

    public int getScale() {
        return size;
    }

    /*public static ArrayList drawShape(BufferedImage tshape, Graphics2D g2_){//, Graphics2D g2) {
        niImage shape = new niImage();
        Coordinates coordinates[] = new Coordinates[tshape.getWidth() * tshape.getHeight()];
        int count = shape.Invert(tshape, coordinates);

        int MAX = 300;
        niSquare tmySquares[] = new niSquare[1000];
        int tx, ty, tsize, tcount, missed, whitespace;
        tsize = 5;
        tcount = 0;
        missed = 0;
        Random gen = new Random();
        //tx = 150;
        //ty = 150;
        whitespace = 1;
        while (tcount < MAX && missed < 9999999) {
            //need a better way to get random coordinates
            int temp = Math.abs(gen.nextInt(count - 1));
            tx = coordinates[temp].x;
            ty = coordinates[temp].y;

            niSquare mySquare = new niSquare(tx, ty, tsize);
            if (!mySquare.checkDrawSquare(whitespace, tshape, g2_)) {
                missed++;
            } else {
                missed = 0;
                //add to array
                tmySquares[tcount++] = mySquare;
            }
            //tcount++;
        }
        System.out.println((tcount) + " squares added");
        Vector mySquares = new Vector();//niSquare mySquares[] = new niSquare[tcount];
        for (int i = 0; i < tcount-1; i++)
            mySquares.addElement(tmySquares[i]);//mySquares[i] = tmySquares[i];
        //for (int i = 0; i < tcount - 1; i++) {
        //    mySquares[i].setColour(Color.red);
        //    mySquares[i].drawSquare(g2);
        //}
        return mySquares;
        //System.out.println((tcount)+" squares added");
    }*/
}
